package system.controller;

import common.controller.base.BaseController;
import common.model.request.ActivateEmailRequest;
import common.model.request.ModifyEmailRequest;
import common.model.response.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import system.service.UserEmailService;

import javax.annotation.Resource;

/**
 * 邮箱激活、变更等
 *
 * @author 米泽鹏
 * @since 2023-11-06
 */
@Api(tags = "邮箱激活、变更等")
@RestController
@RequestMapping("/system/user-email")
public class UserEmailController extends BaseController {

	@Resource
	private UserEmailService userEmailService;

	@ApiOperation(value = "邮箱激活", notes = "邮箱激活")
	@PostMapping("/activateEmail")
	public Result<?> activateEmail(@ApiParam(value = "邮箱激活请求", required = true) @RequestBody @Validated ActivateEmailRequest request) {
		return userEmailService.activateEmail(request);
	}

	@ApiOperation(value = "修改邮箱", notes = "修改邮箱")
	@PostMapping("/modifyEmail")
	public Result<?> modifyEmail(@ApiParam(value = "修改邮箱请求", required = true) @RequestBody @Validated ModifyEmailRequest request) {
		return userEmailService.modifyEmail(request);
	}

}
